/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package it.polimi.deib.se2.meteocal.gui;

import it.polimi.deib.se2.meteocal.business.entity.Location;
import java.io.Serializable;
import java.util.Date;
import org.primefaces.model.ScheduleEvent;

public class MeteoCalScheduleEvent implements ScheduleEvent, Serializable {
    //devo farlo String per forza altrimenti non posso implementare ScheduleEvent
    private String id;
    
    private long idEvent;
    
    private String title;
    private Date startDate;
    private Date endDate;
    private boolean allDay;
    private boolean editable;
    private String description;
    private Location location;
    
    private boolean outdoor;
    private int badWeatherLevel;
    private boolean isPublic;
    
    //richiesti dall'interfaccia implementata
    private String styleClass;
    private Object data;

    public MeteoCalScheduleEvent() {}
	
    public MeteoCalScheduleEvent(String id, String title, Date start, Date end) {
        this.id = id;
	this.title = title;
	this.startDate = start;
	this.endDate = end;
    }
    
    public MeteoCalScheduleEvent(long idEvent, String title, Date start, Date end) {
        this.id = Long.toString(idEvent);
        this.idEvent = idEvent;
	this.title = title;
	this.startDate = start;
	this.endDate = end;
    }

    @Override
    public String getId() {
	return id;
    }
    
    @Override
    public void setId(String id) {
	this.id = id;
    }
    
    @Override
    public String getTitle() {
	return title;
    }
	
    public void setTitle(String title) {
	this.title = title;
    }

    @Override
    public Date getStartDate() {
	return startDate;
    }

    public void setStartDate(Date startDate) {
	this.startDate = startDate;
    }
    
    @Override
    public Date getEndDate() {
	return endDate;
    }

    public void setEndDate(Date endDate) {
	this.endDate = endDate;
    }
    
    @Override
    public boolean isAllDay() {
	return allDay;
    }

    public void setAllDay(boolean allDay) {
    	this.allDay = allDay;
    }
    
    @Override
    public boolean isEditable() {
        return editable;
    }

    public void setEditable(boolean editable) {
        this.editable = editable;
    }   

    @Override
    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }
    
//    @Override
//    public boolean equals(Object obj) {
//        if (obj == null) {
//            return false;
//        }
//        if (getClass() != obj.getClass()) {
//            return false;
//        }
//        final MeteoCalScheduleEvent other = (MeteoCalScheduleEvent) obj;
//        if ((this.title == null) ? (other.title != null) : !this.title.equals(other.title)) {
//            return false;
//        }
//        if (this.startDate != other.startDate && (this.startDate == null || !this.startDate.equals(other.startDate))) {
//            return false;
//        }
//        return !(this.endDate != other.endDate && (this.endDate == null || !this.endDate.equals(other.endDate)));
//    }
    
    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final MeteoCalScheduleEvent other = (MeteoCalScheduleEvent) obj;
        if (this.idEvent == other.idEvent) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public int hashCode() {
        return 0;
    }

    @Override
    public String toString() {
        return "MeteoCalScheduleEvent{title=" + title + ",startDate=" + startDate + ",endDate=" + endDate + "}";
    }

    @Override
    public String getStyleClass() {
        return styleClass;
    }

    public void setStyleClass(String styleClass) {
        this.styleClass = styleClass;
    }

    @Override
    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public boolean isOutdoor() {
        return outdoor;
    }

    public void setOutdoor(boolean outdoor) {
        this.outdoor = outdoor;
    }

    public int getBadWeatherLevel() {
        return badWeatherLevel;
    }

    public void setBadWeatherLevel(int badWeatherLevel) {
        this.badWeatherLevel = badWeatherLevel;
    }

    public boolean isIsPublic() {
        return isPublic;
    }

  public void setIsPublic(boolean isPublic) {
        this.isPublic = isPublic;
    }

    public long getIdEvent() {
        return idEvent;
    }
    
    public void setIdEvent(long idEvent) {
        this.idEvent = idEvent;
    }

    /**
     * @return the location
     */
    public Location getLocation() {
        return location;
    }

    /**
     * @param location the location to set
     */
    public void setLocation(Location location) {
        this.location = location;
    }
}
